package com.hundun.hddeal.service.lmpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hundun.hddeal.dao.FeedbackMapper;
import com.hundun.hddeal.entity.Feedback;
import com.hundun.hddeal.response.Result;
import com.hundun.hddeal.response.ResultUtil;
import com.hundun.hddeal.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 反馈业务层
 * @author 谢
 */
@Service
public class FeedbackServiceImpl implements FeedbackService {
    @Autowired
    FeedbackMapper feedbackMapper;


    @Override
    public Result deleteByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public Result insertSelective(Feedback record) {
        try{
            feedbackMapper.insertSelective(record);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.error();
        }

    }

    @Override
    public Result<Feedback> selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public Result updateByPrimaryKeySelective(Feedback record) {
        return null;
    }


    @Override
    public Result<PageInfo<Feedback>> getAllBymt(Integer page, Integer size,String orderId) {
        try{
            PageHelper.startPage(page, size);
            List<Feedback> FeedbackList = feedbackMapper.getAllBymt(orderId);
            PageInfo<Feedback> pageInfo = new PageInfo<>(FeedbackList);
            return ResultUtil.success(pageInfo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.error();
        }
    }
}
